<!-- HTML header for doxygen 1.8.8-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
    <head>
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!-- For Mobile Devices -->
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
        <meta name="generator" content="Doxygen 1.8.17"/>
        <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
        <title>QuEST: QuEST_cpu_local.c Source File</title>
        <!--<link href="tabs.css" rel="stylesheet" type="text/css"/>-->
        <script type="text/javascript" src="dynsections.js"></script>
        <link href="doxygen.css" rel="stylesheet" type="text/css" />
        <link href="style.css" rel="stylesheet" type="text/css"/>
        <link href='https://fonts.googleapis.com/css?family=Roboto+Slab' rel='stylesheet' type='text/css'>
        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css">
        <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
        <link href="jquery.smartmenus.bootstrap.css" rel="stylesheet">
        <script type="text/javascript" src="jquery.smartmenus.js"></script>
        <!-- SmartMenus jQuery Bootstrap Addon -->
        <script type="text/javascript" src="jquery.smartmenus.bootstrap.js"></script>
        <!-- SmartMenus jQuery plugin -->
    </head>
    <body>
        <nav class="navbar navbar-default" role="navigation">
            <div class="container">
                <div class="navbar-header">
                    <a class="navbar-brand"><img alt="Logo" src="logo.png"/></a>
                    <a class="navbar-brand"><b>QuEST</b> v3.2.0<br>The Quantum Exact Simulation Toolkit</a>
                </div>
            </div>
        </nav>
        <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
            <div class="content" id="content">
                <div class="container">
                    <div class="row">
                        <div class="col-sm-12 panel " style="padding-bottom: 15px;">
                            <div style="margin-bottom: 15px;">
<!-- end header part -->
<!-- Generated by Doxygen 1.8.17 -->
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
  initMenu('',false,false,'search.php','Search');
});
/* @license-end */</script>
<div id="main-nav"></div>
<div id="nav-path" class="navpath">
  <ul>
<li class="navelem"><a class="el" href="dir_d522931ffa1371640980b621734a4381.html">Users</a></li><li class="navelem"><a class="el" href="dir_70834f0dcd10de01d2e35ab402a2238e.html">tysonjones</a></li><li class="navelem"><a class="el" href="dir_1957401ef452be7528010ba0f4832a45.html">Desktop</a></li><li class="navelem"><a class="el" href="dir_dee4414d5d72b49a9429e079789ffd08.html">GithubRepos</a></li><li class="navelem"><a class="el" href="dir_a89b43d59316bb5045aa22bb53a67d29.html">QuEST</a></li><li class="navelem"><a class="el" href="dir_f1fe56bf5ef15ff22696c757278c6962.html">QuEST</a></li><li class="navelem"><a class="el" href="dir_757750313c878cfe3b7d1ade55b4b819.html">src</a></li><li class="navelem"><a class="el" href="dir_b42f528141150d9931abf34c4623dde5.html">CPU</a></li>  </ul>
</div>
</div><!-- top -->
<div class="header">
  <div class="headertitle">
<div class="title">QuEST_cpu_local.c</div>  </div>
</div><!--header-->
<div class="contents">
<a href="QuEST__cpu__local_8c.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno">    1</span>&#160;<span class="comment">// Distributed under MIT licence. See https://github.com/QuEST-Kit/QuEST/blob/master/LICENCE.txt for details </span></div>
<div class="line"><a name="l00002"></a><span class="lineno">    2</span>&#160; </div>
<div class="line"><a name="l00012"></a><span class="lineno">   12</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST_8h.html">QuEST.h</a>&quot;</span></div>
<div class="line"><a name="l00013"></a><span class="lineno">   13</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__internal_8h.html">QuEST_internal.h</a>&quot;</span></div>
<div class="line"><a name="l00014"></a><span class="lineno">   14</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__precision_8h.html">QuEST_precision.h</a>&quot;</span></div>
<div class="line"><a name="l00015"></a><span class="lineno">   15</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="mt19937ar_8h.html">mt19937ar.h</a>&quot;</span></div>
<div class="line"><a name="l00016"></a><span class="lineno">   16</span>&#160; </div>
<div class="line"><a name="l00017"></a><span class="lineno">   17</span>&#160;<span class="preprocessor"># include &quot;<a class="code" href="QuEST__cpu__internal_8h.html">QuEST_cpu_internal.h</a>&quot;</span></div>
<div class="line"><a name="l00018"></a><span class="lineno">   18</span>&#160; </div>
<div class="line"><a name="l00019"></a><span class="lineno">   19</span>&#160;<span class="preprocessor"># include &lt;stdlib.h&gt;</span></div>
<div class="line"><a name="l00020"></a><span class="lineno">   20</span>&#160;<span class="preprocessor"># include &lt;stdio.h&gt;</span></div>
<div class="line"><a name="l00021"></a><span class="lineno">   21</span>&#160;<span class="preprocessor"># include &lt;math.h&gt;</span></div>
<div class="line"><a name="l00022"></a><span class="lineno">   22</span>&#160;<span class="preprocessor"># include &lt;time.h&gt;</span></div>
<div class="line"><a name="l00023"></a><span class="lineno">   23</span>&#160;<span class="preprocessor"># include &lt;sys/types.h&gt;</span></div>
<div class="line"><a name="l00024"></a><span class="lineno">   24</span>&#160; </div>
<div class="line"><a name="l00025"></a><span class="lineno">   25</span>&#160;<span class="preprocessor"># ifdef _OPENMP</span></div>
<div class="line"><a name="l00026"></a><span class="lineno">   26</span>&#160;<span class="preprocessor"># include &lt;omp.h&gt;</span></div>
<div class="line"><a name="l00027"></a><span class="lineno">   27</span>&#160;<span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00028"></a><span class="lineno">   28</span>&#160; </div>
<div class="line"><a name="l00029"></a><span class="lineno">   29</span>&#160; </div>
<div class="line"><a name="l00030"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a398b60c4cb4fa2cf2ffc126de6c08da0">   30</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a398b60c4cb4fa2cf2ffc126de6c08da0">densmatr_mixDepolarising</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> depolLevel) {</div>
<div class="line"><a name="l00031"></a><span class="lineno">   31</span>&#160;    <span class="keywordflow">if</span> (depolLevel == 0)</div>
<div class="line"><a name="l00032"></a><span class="lineno">   32</span>&#160;        <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00033"></a><span class="lineno">   33</span>&#160; </div>
<div class="line"><a name="l00034"></a><span class="lineno">   34</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#ab750fb47da2fca9849c678c869e40e69">densmatr_mixDepolarisingLocal</a>(qureg, targetQubit, depolLevel);</div>
<div class="line"><a name="l00035"></a><span class="lineno">   35</span>&#160;}</div>
<div class="line"><a name="l00036"></a><span class="lineno">   36</span>&#160; </div>
<div class="line"><a name="l00037"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#ac501fe7b9d331be48359ce1546348f97">   37</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#ac501fe7b9d331be48359ce1546348f97">densmatr_mixDamping</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> damping) {</div>
<div class="line"><a name="l00038"></a><span class="lineno">   38</span>&#160;    <span class="keywordflow">if</span> (damping == 0)</div>
<div class="line"><a name="l00039"></a><span class="lineno">   39</span>&#160;        <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00040"></a><span class="lineno">   40</span>&#160; </div>
<div class="line"><a name="l00041"></a><span class="lineno">   41</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#ab124a3a9956046bf9c0e1e3ae9171f42">densmatr_mixDampingLocal</a>(qureg, targetQubit, damping);</div>
<div class="line"><a name="l00042"></a><span class="lineno">   42</span>&#160;}</div>
<div class="line"><a name="l00043"></a><span class="lineno">   43</span>&#160; </div>
<div class="line"><a name="l00044"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a43afa97e300b87bce7f3eb1213eb05f6">   44</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a43afa97e300b87bce7f3eb1213eb05f6">densmatr_mixTwoQubitDepolarising</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qubit1, <span class="keywordtype">int</span> qubit2, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> depolLevel){</div>
<div class="line"><a name="l00045"></a><span class="lineno">   45</span>&#160;    <span class="keywordflow">if</span> (depolLevel == 0)</div>
<div class="line"><a name="l00046"></a><span class="lineno">   46</span>&#160;        <span class="keywordflow">return</span>;</div>
<div class="line"><a name="l00047"></a><span class="lineno">   47</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> eta = 2/depolLevel;</div>
<div class="line"><a name="l00048"></a><span class="lineno">   48</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> delta = eta - 1 - sqrt( (eta-1)*(eta-1) - 1 );</div>
<div class="line"><a name="l00049"></a><span class="lineno">   49</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> gamma = 1+delta;</div>
<div class="line"><a name="l00050"></a><span class="lineno">   50</span>&#160;    <span class="comment">// TODO -- test delta too small</span></div>
<div class="line"><a name="l00051"></a><span class="lineno">   51</span>&#160; </div>
<div class="line"><a name="l00052"></a><span class="lineno">   52</span>&#160;    gamma = 1/(gamma*gamma*gamma);</div>
<div class="line"><a name="l00053"></a><span class="lineno">   53</span>&#160;    <a class="code" href="QuEST__internal_8h.html#a623e577b7230f3c8dc202be6185b4289">densmatr_mixTwoQubitDephasing</a>(qureg, qubit1, qubit2, depolLevel);</div>
<div class="line"><a name="l00054"></a><span class="lineno">   54</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a3510f01d4d15dcc545564eb84c668cad">densmatr_mixTwoQubitDepolarisingLocal</a>(qureg, qubit1, qubit2, delta, gamma);</div>
<div class="line"><a name="l00055"></a><span class="lineno">   55</span>&#160;}</div>
<div class="line"><a name="l00056"></a><span class="lineno">   56</span>&#160; </div>
<div class="line"><a name="l00057"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#ae45eefa65f4ecd37bab84fade7cf7f1f">   57</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00058"></a><span class="lineno">   58</span>&#160;    </div>
<div class="line"><a name="l00059"></a><span class="lineno">   59</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__cpu_8c.html#af910c7cf2b85bdc2c399cfe8dbfb8b9c">densmatr_calcPurityLocal</a>(qureg);</div>
<div class="line"><a name="l00060"></a><span class="lineno">   60</span>&#160;}</div>
<div class="line"><a name="l00061"></a><span class="lineno">   61</span>&#160; </div>
<div class="line"><a name="l00062"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a8c9da88f734b0862f4cce7d819e6d3b5">   62</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a>(<a class="code" href="structQureg.html">Qureg</a> a, <a class="code" href="structQureg.html">Qureg</a> b) {</div>
<div class="line"><a name="l00063"></a><span class="lineno">   63</span>&#160;    </div>
<div class="line"><a name="l00064"></a><span class="lineno">   64</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> distSquared = <a class="code" href="QuEST__cpu_8c.html#a939897137596bb73ad7a028d0beaaa10">densmatr_calcHilbertSchmidtDistanceSquaredLocal</a>(a, b);</div>
<div class="line"><a name="l00065"></a><span class="lineno">   65</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> dist = sqrt(distSquared);</div>
<div class="line"><a name="l00066"></a><span class="lineno">   66</span>&#160;    <span class="keywordflow">return</span> dist;</div>
<div class="line"><a name="l00067"></a><span class="lineno">   67</span>&#160;}</div>
<div class="line"><a name="l00068"></a><span class="lineno">   68</span>&#160; </div>
<div class="line"><a name="l00069"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a6ff3dc624b5fafe8edae4fe327c255a0">   69</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a>(<a class="code" href="structQureg.html">Qureg</a> a, <a class="code" href="structQureg.html">Qureg</a> b) {</div>
<div class="line"><a name="l00070"></a><span class="lineno">   70</span>&#160;    </div>
<div class="line"><a name="l00071"></a><span class="lineno">   71</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> scalar = <a class="code" href="QuEST__cpu_8c.html#a08392b1b27d10e3b8a8648a5afeaa629">densmatr_calcInnerProductLocal</a>(a, b);</div>
<div class="line"><a name="l00072"></a><span class="lineno">   72</span>&#160;    <span class="keywordflow">return</span> scalar;</div>
<div class="line"><a name="l00073"></a><span class="lineno">   73</span>&#160;}</div>
<div class="line"><a name="l00074"></a><span class="lineno">   74</span>&#160; </div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#aa6c3f86010ad398f42b0577ea3bb5bcf">   75</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQureg.html">Qureg</a> pureState) {</div>
<div class="line"><a name="l00076"></a><span class="lineno">   76</span>&#160;    </div>
<div class="line"><a name="l00077"></a><span class="lineno">   77</span>&#160;    <span class="comment">// save pointers to qureg&#39;s pair state</span></div>
<div class="line"><a name="l00078"></a><span class="lineno">   78</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* quregPairRePtr = qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real;</div>
<div class="line"><a name="l00079"></a><span class="lineno">   79</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* quregPairImPtr = qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag;</div>
<div class="line"><a name="l00080"></a><span class="lineno">   80</span>&#160;    </div>
<div class="line"><a name="l00081"></a><span class="lineno">   81</span>&#160;    <span class="comment">// populate qureg pair state with pure state (by repointing)</span></div>
<div class="line"><a name="l00082"></a><span class="lineno">   82</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real = pureState.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real;</div>
<div class="line"><a name="l00083"></a><span class="lineno">   83</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag = pureState.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag;</div>
<div class="line"><a name="l00084"></a><span class="lineno">   84</span>&#160;    </div>
<div class="line"><a name="l00085"></a><span class="lineno">   85</span>&#160;    <span class="comment">// calculate fidelity using pairState</span></div>
<div class="line"><a name="l00086"></a><span class="lineno">   86</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> fid = <a class="code" href="QuEST__cpu_8c.html#a7772f97cb4d92a9825bf3b7c82c3230c">densmatr_calcFidelityLocal</a>(qureg, pureState);</div>
<div class="line"><a name="l00087"></a><span class="lineno">   87</span>&#160;    </div>
<div class="line"><a name="l00088"></a><span class="lineno">   88</span>&#160;    <span class="comment">// restore pointers</span></div>
<div class="line"><a name="l00089"></a><span class="lineno">   89</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real = quregPairRePtr;</div>
<div class="line"><a name="l00090"></a><span class="lineno">   90</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag = quregPairImPtr;</div>
<div class="line"><a name="l00091"></a><span class="lineno">   91</span>&#160;    </div>
<div class="line"><a name="l00092"></a><span class="lineno">   92</span>&#160;    <span class="keywordflow">return</span> fid;</div>
<div class="line"><a name="l00093"></a><span class="lineno">   93</span>&#160;}</div>
<div class="line"><a name="l00094"></a><span class="lineno">   94</span>&#160; </div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a561b599a69a5dab03e55b7cbe259892d">   95</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a561b599a69a5dab03e55b7cbe259892d">densmatr_initPureState</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structQureg.html">Qureg</a> pureState) {</div>
<div class="line"><a name="l00096"></a><span class="lineno">   96</span>&#160;    </div>
<div class="line"><a name="l00097"></a><span class="lineno">   97</span>&#160;    <span class="comment">// save pointers to qureg&#39;s pair state</span></div>
<div class="line"><a name="l00098"></a><span class="lineno">   98</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* quregPairRePtr = qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real;</div>
<div class="line"><a name="l00099"></a><span class="lineno">   99</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* quregPairImPtr = qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag;</div>
<div class="line"><a name="l00100"></a><span class="lineno">  100</span>&#160;    </div>
<div class="line"><a name="l00101"></a><span class="lineno">  101</span>&#160;    <span class="comment">// populate qureg pair state with pure state (by repointing)</span></div>
<div class="line"><a name="l00102"></a><span class="lineno">  102</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real = pureState.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real;</div>
<div class="line"><a name="l00103"></a><span class="lineno">  103</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag = pureState.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag;</div>
<div class="line"><a name="l00104"></a><span class="lineno">  104</span>&#160; </div>
<div class="line"><a name="l00105"></a><span class="lineno">  105</span>&#160;    <span class="comment">// populate density matrix via it&#39;s pairState</span></div>
<div class="line"><a name="l00106"></a><span class="lineno">  106</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a1b36518c8fbbc3a5084bb4ad1fb05ea5">densmatr_initPureStateLocal</a>(qureg, pureState);</div>
<div class="line"><a name="l00107"></a><span class="lineno">  107</span>&#160;    </div>
<div class="line"><a name="l00108"></a><span class="lineno">  108</span>&#160;    <span class="comment">// restore pointers</span></div>
<div class="line"><a name="l00109"></a><span class="lineno">  109</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real = quregPairRePtr;</div>
<div class="line"><a name="l00110"></a><span class="lineno">  110</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag = quregPairImPtr;</div>
<div class="line"><a name="l00111"></a><span class="lineno">  111</span>&#160;}</div>
<div class="line"><a name="l00112"></a><span class="lineno">  112</span>&#160; </div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a7ebd3198a198f4cd20840f64fd8b84d0">  113</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="QuEST__cpu__local_8c.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a>(<a class="code" href="structQureg.html">Qureg</a> bra, <a class="code" href="structQureg.html">Qureg</a> ket) {</div>
<div class="line"><a name="l00114"></a><span class="lineno">  114</span>&#160;    </div>
<div class="line"><a name="l00115"></a><span class="lineno">  115</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__cpu_8c.html#a6fbb3b693f25dde1e9e3dc87dc1984f7">statevec_calcInnerProductLocal</a>(bra, ket);</div>
<div class="line"><a name="l00116"></a><span class="lineno">  116</span>&#160;}</div>
<div class="line"><a name="l00117"></a><span class="lineno">  117</span>&#160; </div>
<div class="line"><a name="l00118"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a6153547f245c05874161a105e9a2f02c">  118</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a>(<a class="code" href="structQureg.html">Qureg</a> qureg) {</div>
<div class="line"><a name="l00119"></a><span class="lineno">  119</span>&#160;    </div>
<div class="line"><a name="l00120"></a><span class="lineno">  120</span>&#160;    <span class="comment">// computes the trace using Kahan summation</span></div>
<div class="line"><a name="l00121"></a><span class="lineno">  121</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> pTotal=0;</div>
<div class="line"><a name="l00122"></a><span class="lineno">  122</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> y, t, c;</div>
<div class="line"><a name="l00123"></a><span class="lineno">  123</span>&#160;    c = 0;</div>
<div class="line"><a name="l00124"></a><span class="lineno">  124</span>&#160;    </div>
<div class="line"><a name="l00125"></a><span class="lineno">  125</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numCols = 1LL &lt;&lt; qureg.<a class="code" href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">numQubitsRepresented</a>;</div>
<div class="line"><a name="l00126"></a><span class="lineno">  126</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> diagIndex;</div>
<div class="line"><a name="l00127"></a><span class="lineno">  127</span>&#160;    </div>
<div class="line"><a name="l00128"></a><span class="lineno">  128</span>&#160;    <span class="keywordflow">for</span> (<span class="keywordtype">int</span> col=0; col&lt; numCols; col++) {</div>
<div class="line"><a name="l00129"></a><span class="lineno">  129</span>&#160;        diagIndex = col*(numCols + 1);</div>
<div class="line"><a name="l00130"></a><span class="lineno">  130</span>&#160;        y = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real[diagIndex] - c;</div>
<div class="line"><a name="l00131"></a><span class="lineno">  131</span>&#160;        t = pTotal + y;</div>
<div class="line"><a name="l00132"></a><span class="lineno">  132</span>&#160;        c = ( t - pTotal ) - y; <span class="comment">// brackets are important</span></div>
<div class="line"><a name="l00133"></a><span class="lineno">  133</span>&#160;        pTotal = t;</div>
<div class="line"><a name="l00134"></a><span class="lineno">  134</span>&#160;    }</div>
<div class="line"><a name="l00135"></a><span class="lineno">  135</span>&#160;    </div>
<div class="line"><a name="l00136"></a><span class="lineno">  136</span>&#160;    <span class="comment">// does not check imaginary component, by design</span></div>
<div class="line"><a name="l00137"></a><span class="lineno">  137</span>&#160;        </div>
<div class="line"><a name="l00138"></a><span class="lineno">  138</span>&#160;    <span class="keywordflow">return</span> pTotal;</div>
<div class="line"><a name="l00139"></a><span class="lineno">  139</span>&#160;}</div>
<div class="line"><a name="l00140"></a><span class="lineno">  140</span>&#160; </div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">  141</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a>(<a class="code" href="structQureg.html">Qureg</a> qureg){</div>
<div class="line"><a name="l00142"></a><span class="lineno">  142</span>&#160;    <span class="comment">// implemented using Kahan summation for greater accuracy at a slight floating</span></div>
<div class="line"><a name="l00143"></a><span class="lineno">  143</span>&#160;    <span class="comment">// point operation overhead. For more details see https://en.wikipedia.org/wiki/Kahan_summation_algorithm</span></div>
<div class="line"><a name="l00144"></a><span class="lineno">  144</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> pTotal=0; </div>
<div class="line"><a name="l00145"></a><span class="lineno">  145</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> y, t, c;</div>
<div class="line"><a name="l00146"></a><span class="lineno">  146</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index;</div>
<div class="line"><a name="l00147"></a><span class="lineno">  147</span>&#160;    <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> numAmpsPerRank = qureg.<a class="code" href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">numAmpsPerChunk</a>;</div>
<div class="line"><a name="l00148"></a><span class="lineno">  148</span>&#160;    c = 0.0;</div>
<div class="line"><a name="l00149"></a><span class="lineno">  149</span>&#160;    <span class="keywordflow">for</span> (index=0; index&lt;numAmpsPerRank; index++){ </div>
<div class="line"><a name="l00150"></a><span class="lineno">  150</span>&#160;        <span class="comment">// Perform pTotal+=qureg.stateVec.real[index]*qureg.stateVec.real[index]; by Kahan</span></div>
<div class="line"><a name="l00151"></a><span class="lineno">  151</span>&#160; </div>
<div class="line"><a name="l00152"></a><span class="lineno">  152</span>&#160;        y = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real[index]*qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real[index] - c;</div>
<div class="line"><a name="l00153"></a><span class="lineno">  153</span>&#160;        t = pTotal + y;</div>
<div class="line"><a name="l00154"></a><span class="lineno">  154</span>&#160;        <span class="comment">// Don&#39;t change the bracketing on the following line</span></div>
<div class="line"><a name="l00155"></a><span class="lineno">  155</span>&#160;        c = ( t - pTotal ) - y;</div>
<div class="line"><a name="l00156"></a><span class="lineno">  156</span>&#160;        pTotal = t;</div>
<div class="line"><a name="l00157"></a><span class="lineno">  157</span>&#160; </div>
<div class="line"><a name="l00158"></a><span class="lineno">  158</span>&#160;        <span class="comment">// Perform pTotal+=qureg.stateVec.imag[index]*qureg.stateVec.imag[index]; by Kahan</span></div>
<div class="line"><a name="l00159"></a><span class="lineno">  159</span>&#160; </div>
<div class="line"><a name="l00160"></a><span class="lineno">  160</span>&#160;        y = qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag[index]*qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag[index] - c;</div>
<div class="line"><a name="l00161"></a><span class="lineno">  161</span>&#160;        t = pTotal + y;</div>
<div class="line"><a name="l00162"></a><span class="lineno">  162</span>&#160;        <span class="comment">// Don&#39;t change the bracketing on the following line</span></div>
<div class="line"><a name="l00163"></a><span class="lineno">  163</span>&#160;        c = ( t - pTotal ) - y;</div>
<div class="line"><a name="l00164"></a><span class="lineno">  164</span>&#160;        pTotal = t;</div>
<div class="line"><a name="l00165"></a><span class="lineno">  165</span>&#160;    } </div>
<div class="line"><a name="l00166"></a><span class="lineno">  166</span>&#160;    <span class="keywordflow">return</span> pTotal;</div>
<div class="line"><a name="l00167"></a><span class="lineno">  167</span>&#160;}</div>
<div class="line"><a name="l00168"></a><span class="lineno">  168</span>&#160; </div>
<div class="line"><a name="l00169"></a><span class="lineno">  169</span>&#160; </div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="line" href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">  170</a></span>&#160;<a class="code" href="structQuESTEnv.html">QuESTEnv</a> <a class="code" href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">createQuESTEnv</a>(<span class="keywordtype">void</span>) {</div>
<div class="line"><a name="l00171"></a><span class="lineno">  171</span>&#160;    <span class="comment">// init MPI environment</span></div>
<div class="line"><a name="l00172"></a><span class="lineno">  172</span>&#160;    </div>
<div class="line"><a name="l00173"></a><span class="lineno">  173</span>&#160;    <a class="code" href="structQuESTEnv.html">QuESTEnv</a> env;</div>
<div class="line"><a name="l00174"></a><span class="lineno">  174</span>&#160;    env.<a class="code" href="structQuESTEnv.html#aa648bb336cf8598467cb62db00b9cee8">rank</a>=0;</div>
<div class="line"><a name="l00175"></a><span class="lineno">  175</span>&#160;    env.<a class="code" href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">numRanks</a>=1;</div>
<div class="line"><a name="l00176"></a><span class="lineno">  176</span>&#160;    </div>
<div class="line"><a name="l00177"></a><span class="lineno">  177</span>&#160;    <a class="code" href="group__debug.html#gaa8437ef3bf135231e2916e64dde1c94e">seedQuESTDefault</a>();</div>
<div class="line"><a name="l00178"></a><span class="lineno">  178</span>&#160;    </div>
<div class="line"><a name="l00179"></a><span class="lineno">  179</span>&#160;    <span class="keywordflow">return</span> env;</div>
<div class="line"><a name="l00180"></a><span class="lineno">  180</span>&#160;}</div>
<div class="line"><a name="l00181"></a><span class="lineno">  181</span>&#160; </div>
<div class="line"><a name="l00182"></a><span class="lineno"><a class="line" href="group__debug.html#ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77">  182</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__debug.html#ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77">syncQuESTEnv</a>(<a class="code" href="structQuESTEnv.html">QuESTEnv</a> env){</div>
<div class="line"><a name="l00183"></a><span class="lineno">  183</span>&#160;    <span class="comment">// MPI Barrier goes here in MPI version. </span></div>
<div class="line"><a name="l00184"></a><span class="lineno">  184</span>&#160;} </div>
<div class="line"><a name="l00185"></a><span class="lineno">  185</span>&#160; </div>
<div class="line"><a name="l00186"></a><span class="lineno"><a class="line" href="group__debug.html#gac7e38d768a1bd79019f88cc1e6295092">  186</a></span>&#160;<span class="keywordtype">int</span> <a class="code" href="group__debug.html#gac7e38d768a1bd79019f88cc1e6295092">syncQuESTSuccess</a>(<span class="keywordtype">int</span> successCode){</div>
<div class="line"><a name="l00187"></a><span class="lineno">  187</span>&#160;    <span class="keywordflow">return</span> successCode;</div>
<div class="line"><a name="l00188"></a><span class="lineno">  188</span>&#160;}</div>
<div class="line"><a name="l00189"></a><span class="lineno">  189</span>&#160; </div>
<div class="line"><a name="l00190"></a><span class="lineno"><a class="line" href="group__type.html#gaeff624226629d7063a8a776958a4f991">  190</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__type.html#gaeff624226629d7063a8a776958a4f991">destroyQuESTEnv</a>(<a class="code" href="structQuESTEnv.html">QuESTEnv</a> env){</div>
<div class="line"><a name="l00191"></a><span class="lineno">  191</span>&#160;    <span class="comment">// MPI finalize goes here in MPI version. Call this function anyway for consistency</span></div>
<div class="line"><a name="l00192"></a><span class="lineno">  192</span>&#160;}</div>
<div class="line"><a name="l00193"></a><span class="lineno">  193</span>&#160; </div>
<div class="line"><a name="l00194"></a><span class="lineno"><a class="line" href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">  194</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">reportQuESTEnv</a>(<a class="code" href="structQuESTEnv.html">QuESTEnv</a> env){</div>
<div class="line"><a name="l00195"></a><span class="lineno">  195</span>&#160;    printf(<span class="stringliteral">&quot;EXECUTION ENVIRONMENT:\n&quot;</span>);</div>
<div class="line"><a name="l00196"></a><span class="lineno">  196</span>&#160;    printf(<span class="stringliteral">&quot;Running locally on one node\n&quot;</span>);</div>
<div class="line"><a name="l00197"></a><span class="lineno">  197</span>&#160;    printf(<span class="stringliteral">&quot;Number of ranks is %d\n&quot;</span>, env.<a class="code" href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">numRanks</a>);</div>
<div class="line"><a name="l00198"></a><span class="lineno">  198</span>&#160;<span class="preprocessor"># ifdef _OPENMP</span></div>
<div class="line"><a name="l00199"></a><span class="lineno">  199</span>&#160;    printf(<span class="stringliteral">&quot;OpenMP enabled\n&quot;</span>);</div>
<div class="line"><a name="l00200"></a><span class="lineno">  200</span>&#160;    printf(<span class="stringliteral">&quot;Number of threads available is %d\n&quot;</span>, omp_get_max_threads());</div>
<div class="line"><a name="l00201"></a><span class="lineno">  201</span>&#160;<span class="preprocessor"># else</span></div>
<div class="line"><a name="l00202"></a><span class="lineno">  202</span>&#160;    printf(<span class="stringliteral">&quot;OpenMP disabled\n&quot;</span>);</div>
<div class="line"><a name="l00203"></a><span class="lineno">  203</span>&#160;<span class="preprocessor"># endif</span></div>
<div class="line"><a name="l00204"></a><span class="lineno">  204</span>&#160;    printf(<span class="stringliteral">&quot;Precision: size of qreal is %ld bytes\n&quot;</span>, <span class="keyword">sizeof</span>(<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>));</div>
<div class="line"><a name="l00205"></a><span class="lineno">  205</span>&#160;}</div>
<div class="line"><a name="l00206"></a><span class="lineno">  206</span>&#160; </div>
<div class="line"><a name="l00207"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#abc9a9ef4344c7faaaf28ac25c76649b9">  207</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index){</div>
<div class="line"><a name="l00208"></a><span class="lineno">  208</span>&#160;    <span class="keywordflow">return</span> qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.real[index];</div>
<div class="line"><a name="l00209"></a><span class="lineno">  209</span>&#160;}</div>
<div class="line"><a name="l00210"></a><span class="lineno">  210</span>&#160; </div>
<div class="line"><a name="l00211"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#abd509244d57657e148e4084c5ab5d28f">  211</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> index){</div>
<div class="line"><a name="l00212"></a><span class="lineno">  212</span>&#160;    <span class="keywordflow">return</span> qureg.<a class="code" href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">stateVec</a>.imag[index];</div>
<div class="line"><a name="l00213"></a><span class="lineno">  213</span>&#160;}</div>
<div class="line"><a name="l00214"></a><span class="lineno">  214</span>&#160; </div>
<div class="line"><a name="l00215"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#aec63559e8b9ab0e17efe18d64d2ceca6">  215</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplex.html">Complex</a> alpha, <a class="code" href="structComplex.html">Complex</a> beta) </div>
<div class="line"><a name="l00216"></a><span class="lineno">  216</span>&#160;{</div>
<div class="line"><a name="l00217"></a><span class="lineno">  217</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a5ddfdb22e4704b680d67d08d9e80835b">statevec_compactUnitaryLocal</a>(qureg, targetQubit, alpha, beta);</div>
<div class="line"><a name="l00218"></a><span class="lineno">  218</span>&#160;}</div>
<div class="line"><a name="l00219"></a><span class="lineno">  219</span>&#160; </div>
<div class="line"><a name="l00220"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#ac3735bd959600e57b2ee3a105666cddf">  220</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) </div>
<div class="line"><a name="l00221"></a><span class="lineno">  221</span>&#160;{</div>
<div class="line"><a name="l00222"></a><span class="lineno">  222</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#aafc398f8f479fcc066a2dea700235635">statevec_unitaryLocal</a>(qureg, targetQubit, u);</div>
<div class="line"><a name="l00223"></a><span class="lineno">  223</span>&#160;}</div>
<div class="line"><a name="l00224"></a><span class="lineno">  224</span>&#160; </div>
<div class="line"><a name="l00225"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a1275d604674224d87a173fb5bac78835">  225</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplex.html">Complex</a> alpha, <a class="code" href="structComplex.html">Complex</a> beta) </div>
<div class="line"><a name="l00226"></a><span class="lineno">  226</span>&#160;{</div>
<div class="line"><a name="l00227"></a><span class="lineno">  227</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a215e2d6f88dbecc0b408b3573b5e144f">statevec_controlledCompactUnitaryLocal</a>(qureg, controlQubit, targetQubit, alpha, beta);</div>
<div class="line"><a name="l00228"></a><span class="lineno">  228</span>&#160;}</div>
<div class="line"><a name="l00229"></a><span class="lineno">  229</span>&#160; </div>
<div class="line"><a name="l00230"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#add9ca9956cdd81ed5d0b0f66168c04a3">  230</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) </div>
<div class="line"><a name="l00231"></a><span class="lineno">  231</span>&#160;{</div>
<div class="line"><a name="l00232"></a><span class="lineno">  232</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a903beb4f5d8753a964ce2dc5f9096a24">statevec_controlledUnitaryLocal</a>(qureg, controlQubit, targetQubit, u);</div>
<div class="line"><a name="l00233"></a><span class="lineno">  233</span>&#160;}</div>
<div class="line"><a name="l00234"></a><span class="lineno">  234</span>&#160; </div>
<div class="line"><a name="l00235"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a600bda10463e2078ce746ec28f2d39c9">  235</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlQubitsMask, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlFlipMask, <span class="keywordtype">int</span> targetQubit, <a class="code" href="structComplexMatrix2.html">ComplexMatrix2</a> u) </div>
<div class="line"><a name="l00236"></a><span class="lineno">  236</span>&#160;{</div>
<div class="line"><a name="l00237"></a><span class="lineno">  237</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#ab19f28e68330da68ea3caa2bdef32da9">statevec_multiControlledUnitaryLocal</a>(qureg, targetQubit, ctrlQubitsMask, ctrlFlipMask, u);</div>
<div class="line"><a name="l00238"></a><span class="lineno">  238</span>&#160;}</div>
<div class="line"><a name="l00239"></a><span class="lineno">  239</span>&#160; </div>
<div class="line"><a name="l00240"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a1c82b5e914a8a39c5c7b782dbc16fa76">  240</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) </div>
<div class="line"><a name="l00241"></a><span class="lineno">  241</span>&#160;{</div>
<div class="line"><a name="l00242"></a><span class="lineno">  242</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#aa987d1e0ba97da2ca540194356dd62de">statevec_pauliXLocal</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00243"></a><span class="lineno">  243</span>&#160;}</div>
<div class="line"><a name="l00244"></a><span class="lineno">  244</span>&#160; </div>
<div class="line"><a name="l00245"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">  245</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) </div>
<div class="line"><a name="l00246"></a><span class="lineno">  246</span>&#160;{</div>
<div class="line"><a name="l00247"></a><span class="lineno">  247</span>&#160;    <span class="keywordtype">int</span> conjFac = 1;</div>
<div class="line"><a name="l00248"></a><span class="lineno">  248</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a45b0916c3e121837f214b64f7424e479">statevec_pauliYLocal</a>(qureg, targetQubit, conjFac);</div>
<div class="line"><a name="l00249"></a><span class="lineno">  249</span>&#160;}</div>
<div class="line"><a name="l00250"></a><span class="lineno">  250</span>&#160; </div>
<div class="line"><a name="l00251"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">  251</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) </div>
<div class="line"><a name="l00252"></a><span class="lineno">  252</span>&#160;{</div>
<div class="line"><a name="l00253"></a><span class="lineno">  253</span>&#160;    <span class="keywordtype">int</span> conjFac = -1;</div>
<div class="line"><a name="l00254"></a><span class="lineno">  254</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a45b0916c3e121837f214b64f7424e479">statevec_pauliYLocal</a>(qureg, targetQubit, conjFac);</div>
<div class="line"><a name="l00255"></a><span class="lineno">  255</span>&#160;}</div>
<div class="line"><a name="l00256"></a><span class="lineno">  256</span>&#160; </div>
<div class="line"><a name="l00257"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a4e19ef93d01d7acea32ca646d623aedd">  257</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit)</div>
<div class="line"><a name="l00258"></a><span class="lineno">  258</span>&#160;{</div>
<div class="line"><a name="l00259"></a><span class="lineno">  259</span>&#160;    <span class="keywordtype">int</span> conjFac = 1;</div>
<div class="line"><a name="l00260"></a><span class="lineno">  260</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a06fb16aa4af7c54d36052a14d3ad58a7">statevec_controlledPauliYLocal</a>(qureg, controlQubit, targetQubit, conjFac);</div>
<div class="line"><a name="l00261"></a><span class="lineno">  261</span>&#160;}</div>
<div class="line"><a name="l00262"></a><span class="lineno">  262</span>&#160; </div>
<div class="line"><a name="l00263"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a4a2fa262d3f0dba372797b9bd35d9fa5">  263</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit)</div>
<div class="line"><a name="l00264"></a><span class="lineno">  264</span>&#160;{</div>
<div class="line"><a name="l00265"></a><span class="lineno">  265</span>&#160;    <span class="keywordtype">int</span> conjFac = -1;</div>
<div class="line"><a name="l00266"></a><span class="lineno">  266</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a06fb16aa4af7c54d36052a14d3ad58a7">statevec_controlledPauliYLocal</a>(qureg, controlQubit, targetQubit, conjFac);</div>
<div class="line"><a name="l00267"></a><span class="lineno">  267</span>&#160;}</div>
<div class="line"><a name="l00268"></a><span class="lineno">  268</span>&#160; </div>
<div class="line"><a name="l00269"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#af3fc7bd149c70f083b149050242cd55e">  269</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> targetQubit) </div>
<div class="line"><a name="l00270"></a><span class="lineno">  270</span>&#160;{</div>
<div class="line"><a name="l00271"></a><span class="lineno">  271</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a86dbcc3db99294add9964741e19fbdab">statevec_hadamardLocal</a>(qureg, targetQubit);</div>
<div class="line"><a name="l00272"></a><span class="lineno">  272</span>&#160;}</div>
<div class="line"><a name="l00273"></a><span class="lineno">  273</span>&#160; </div>
<div class="line"><a name="l00274"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#abb2eab4af99adcc59be24f4c91c6f6ad">  274</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> controlQubit, <span class="keywordtype">int</span> targetQubit) </div>
<div class="line"><a name="l00275"></a><span class="lineno">  275</span>&#160;{</div>
<div class="line"><a name="l00276"></a><span class="lineno">  276</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#ace1482ef82b83e7f926634a67b322fc4">statevec_controlledNotLocal</a>(qureg, controlQubit, targetQubit);</div>
<div class="line"><a name="l00277"></a><span class="lineno">  277</span>&#160;}</div>
<div class="line"><a name="l00278"></a><span class="lineno">  278</span>&#160; </div>
<div class="line"><a name="l00279"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a63cb88a5f4eb12fef087435b8db3f8eb">  279</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit, <span class="keywordtype">int</span> outcome)</div>
<div class="line"><a name="l00280"></a><span class="lineno">  280</span>&#160;{</div>
<div class="line"><a name="l00281"></a><span class="lineno">  281</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> stateProb=0;</div>
<div class="line"><a name="l00282"></a><span class="lineno">  282</span>&#160;    stateProb = <a class="code" href="QuEST__cpu_8c.html#a8535bc15c2ff249ddddb3fde6eff1490">statevec_findProbabilityOfZeroLocal</a>(qureg, measureQubit);</div>
<div class="line"><a name="l00283"></a><span class="lineno">  283</span>&#160;    <span class="keywordflow">if</span> (outcome==1) stateProb = 1.0 - stateProb;</div>
<div class="line"><a name="l00284"></a><span class="lineno">  284</span>&#160;    <span class="keywordflow">return</span> stateProb;</div>
<div class="line"><a name="l00285"></a><span class="lineno">  285</span>&#160;}</div>
<div class="line"><a name="l00286"></a><span class="lineno">  286</span>&#160; </div>
<div class="line"><a name="l00287"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#ae37b3eff5d3affbc1edfe216cabc1c53">  287</a></span>&#160;<a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> <a class="code" href="QuEST__cpu__local_8c.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit, <span class="keywordtype">int</span> outcome) {</div>
<div class="line"><a name="l00288"></a><span class="lineno">  288</span>&#160;    </div>
<div class="line"><a name="l00289"></a><span class="lineno">  289</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> outcomeProb = <a class="code" href="QuEST__cpu_8c.html#a8bea931504c90d9bd97e74645667804e">densmatr_findProbabilityOfZeroLocal</a>(qureg, measureQubit);</div>
<div class="line"><a name="l00290"></a><span class="lineno">  290</span>&#160;    <span class="keywordflow">if</span> (outcome == 1)</div>
<div class="line"><a name="l00291"></a><span class="lineno">  291</span>&#160;        outcomeProb = 1.0 - outcomeProb;</div>
<div class="line"><a name="l00292"></a><span class="lineno">  292</span>&#160;    <span class="keywordflow">return</span> outcomeProb;</div>
<div class="line"><a name="l00293"></a><span class="lineno">  293</span>&#160;}</div>
<div class="line"><a name="l00294"></a><span class="lineno">  294</span>&#160; </div>
<div class="line"><a name="l00295"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a8c13e3ef40a58a27a4c04ad69bde14bc">  295</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a8c13e3ef40a58a27a4c04ad69bde14bc">statevec_collapseToKnownProbOutcome</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> measureQubit, <span class="keywordtype">int</span> outcome, <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a> stateProb)</div>
<div class="line"><a name="l00296"></a><span class="lineno">  296</span>&#160;{</div>
<div class="line"><a name="l00297"></a><span class="lineno">  297</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#ab02bce0ebbb8f624e8ced8b09b99cdef">statevec_collapseToKnownProbOutcomeLocal</a>(qureg, measureQubit, outcome, stateProb);</div>
<div class="line"><a name="l00298"></a><span class="lineno">  298</span>&#160;}</div>
<div class="line"><a name="l00299"></a><span class="lineno">  299</span>&#160; </div>
<div class="line"><a name="l00300"></a><span class="lineno"><a class="line" href="group__debug.html#gaa8437ef3bf135231e2916e64dde1c94e">  300</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="group__debug.html#gaa8437ef3bf135231e2916e64dde1c94e">seedQuESTDefault</a>(<span class="keywordtype">void</span>){</div>
<div class="line"><a name="l00301"></a><span class="lineno">  301</span>&#160;    <span class="comment">// init MT random number generator with three keys -- time and pid</span></div>
<div class="line"><a name="l00302"></a><span class="lineno">  302</span>&#160;    <span class="comment">// for the MPI version, it is ok that all procs will get the same seed as random numbers will only be </span></div>
<div class="line"><a name="l00303"></a><span class="lineno">  303</span>&#160;    <span class="comment">// used by the master process</span></div>
<div class="line"><a name="l00304"></a><span class="lineno">  304</span>&#160; </div>
<div class="line"><a name="l00305"></a><span class="lineno">  305</span>&#160;    <span class="keywordtype">unsigned</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> key[2];</div>
<div class="line"><a name="l00306"></a><span class="lineno">  306</span>&#160;    <a class="code" href="QuEST__common_8c.html#a2b323b65cd6512720e6aa27c182fcea0">getQuESTDefaultSeedKey</a>(key);</div>
<div class="line"><a name="l00307"></a><span class="lineno">  307</span>&#160;    <a class="code" href="mt19937ar_8c.html#ac1283f9b1ed571332f5ffe53545ffc16">init_by_array</a>(key, 2);</div>
<div class="line"><a name="l00308"></a><span class="lineno">  308</span>&#160;}</div>
<div class="line"><a name="l00309"></a><span class="lineno">  309</span>&#160; </div>
<div class="line"><a name="l00310"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#affbd18d7c2ed8d5bd5edb67116501145">  310</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#affbd18d7c2ed8d5bd5edb67116501145">statevec_multiControlledTwoQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlMask, <span class="keywordtype">int</span> q1, <span class="keywordtype">int</span> q2, <a class="code" href="structComplexMatrix4.html">ComplexMatrix4</a> u)</div>
<div class="line"><a name="l00311"></a><span class="lineno">  311</span>&#160;{</div>
<div class="line"><a name="l00312"></a><span class="lineno">  312</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#af8236a00389137b5eff986a40577eaf3">statevec_multiControlledTwoQubitUnitaryLocal</a>(qureg, ctrlMask, q1, q2, u);</div>
<div class="line"><a name="l00313"></a><span class="lineno">  313</span>&#160;}</div>
<div class="line"><a name="l00314"></a><span class="lineno">  314</span>&#160; </div>
<div class="line"><a name="l00315"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a0acfe30083d0bc2a84da196378a36122">  315</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">long</span> <span class="keywordtype">long</span> <span class="keywordtype">int</span> ctrlMask, <span class="keywordtype">int</span>* targs, <span class="keywordtype">int</span> numTargs, <a class="code" href="structComplexMatrixN.html">ComplexMatrixN</a> u)</div>
<div class="line"><a name="l00316"></a><span class="lineno">  316</span>&#160;{</div>
<div class="line"><a name="l00317"></a><span class="lineno">  317</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#a0aedcccfa50c7aaa8b7fc4c14d7cdfb8">statevec_multiControlledMultiQubitUnitaryLocal</a>(qureg, ctrlMask, targs, numTargs, u);</div>
<div class="line"><a name="l00318"></a><span class="lineno">  318</span>&#160;}</div>
<div class="line"><a name="l00319"></a><span class="lineno">  319</span>&#160; </div>
<div class="line"><a name="l00320"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#ab7478fcaf6357ab202d72853b672e375">  320</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <span class="keywordtype">int</span> qb1, <span class="keywordtype">int</span> qb2) </div>
<div class="line"><a name="l00321"></a><span class="lineno">  321</span>&#160;{</div>
<div class="line"><a name="l00322"></a><span class="lineno">  322</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#ab5b51a28caa8792a3f0c637409a694b0">statevec_swapQubitAmpsLocal</a>(qureg, qb1, qb2);</div>
<div class="line"><a name="l00323"></a><span class="lineno">  323</span>&#160;}</div>
<div class="line"><a name="l00324"></a><span class="lineno">  324</span>&#160; </div>
<div class="line"><a name="l00325"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#aedd7ecccf2f09dd2f1c5d191950b51e6">  325</a></span>&#160;<span class="keywordtype">void</span> <a class="code" href="QuEST__cpu__local_8c.html#aedd7ecccf2f09dd2f1c5d191950b51e6">densmatr_applyDiagonalOp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structDiagonalOp.html">DiagonalOp</a> op) {</div>
<div class="line"><a name="l00326"></a><span class="lineno">  326</span>&#160; </div>
<div class="line"><a name="l00327"></a><span class="lineno">  327</span>&#160;    <span class="comment">// we must preload qureg.pairStateVec with the elements of op.</span></div>
<div class="line"><a name="l00328"></a><span class="lineno">  328</span>&#160;    <span class="comment">// instead of needless cloning, we&#39;ll just temporarily swap the pointers</span></div>
<div class="line"><a name="l00329"></a><span class="lineno">  329</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* rePtr = qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real;</div>
<div class="line"><a name="l00330"></a><span class="lineno">  330</span>&#160;    <a class="code" href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a>* imPtr = qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag;</div>
<div class="line"><a name="l00331"></a><span class="lineno">  331</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real = op.<a class="code" href="structDiagonalOp.html#a1d66088bed235d524cd452b107694d5c">real</a>;</div>
<div class="line"><a name="l00332"></a><span class="lineno">  332</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag = op.<a class="code" href="structDiagonalOp.html#a85c3f52533efe831bbe40b9a48602388">imag</a>;</div>
<div class="line"><a name="l00333"></a><span class="lineno">  333</span>&#160;    </div>
<div class="line"><a name="l00334"></a><span class="lineno">  334</span>&#160;    <a class="code" href="QuEST__cpu_8c.html#afa58cf7cb98a25ab33621120c5c330d0">densmatr_applyDiagonalOpLocal</a>(qureg, op);</div>
<div class="line"><a name="l00335"></a><span class="lineno">  335</span>&#160;    </div>
<div class="line"><a name="l00336"></a><span class="lineno">  336</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.real = rePtr;</div>
<div class="line"><a name="l00337"></a><span class="lineno">  337</span>&#160;    qureg.<a class="code" href="structQureg.html#aba97773694870ef35e378c036f486bb7">pairStateVec</a>.imag = imPtr;</div>
<div class="line"><a name="l00338"></a><span class="lineno">  338</span>&#160;}</div>
<div class="line"><a name="l00339"></a><span class="lineno">  339</span>&#160; </div>
<div class="line"><a name="l00340"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a0fb948ddab4ca210e523aa3c52639df4">  340</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="QuEST__cpu__local_8c.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structDiagonalOp.html">DiagonalOp</a> op) {</div>
<div class="line"><a name="l00341"></a><span class="lineno">  341</span>&#160; </div>
<div class="line"><a name="l00342"></a><span class="lineno">  342</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__cpu_8c.html#a16ccb485bcffb328bbd5b2af6977cead">statevec_calcExpecDiagonalOpLocal</a>(qureg, op);</div>
<div class="line"><a name="l00343"></a><span class="lineno">  343</span>&#160;}</div>
<div class="line"><a name="l00344"></a><span class="lineno">  344</span>&#160; </div>
<div class="line"><a name="l00345"></a><span class="lineno"><a class="line" href="QuEST__cpu__local_8c.html#a70e3b0a2297c186d5c779af31459b4ca">  345</a></span>&#160;<a class="code" href="structComplex.html">Complex</a> <a class="code" href="QuEST__cpu__local_8c.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a>(<a class="code" href="structQureg.html">Qureg</a> qureg, <a class="code" href="structDiagonalOp.html">DiagonalOp</a> op) {</div>
<div class="line"><a name="l00346"></a><span class="lineno">  346</span>&#160;    </div>
<div class="line"><a name="l00347"></a><span class="lineno">  347</span>&#160;    <span class="keywordflow">return</span> <a class="code" href="QuEST__cpu_8c.html#aeb4453a2e609e5359d2995bccf6663ca">densmatr_calcExpecDiagonalOpLocal</a>(qureg, op);</div>
<div class="line"><a name="l00348"></a><span class="lineno">  348</span>&#160;}</div>
</div><!-- fragment --></div><!-- contents -->
<div class="ttc" id="aQuEST__cpu__local_8c_html_a6153547f245c05874161a105e9a2f02c"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a6153547f245c05874161a105e9a2f02c">densmatr_calcTotalProb</a></div><div class="ttdeci">qreal densmatr_calcTotalProb(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00118">QuEST_cpu_local.c:118</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a81fbd2eccd0d0e5a3cece4df2f96cb92"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a81fbd2eccd0d0e5a3cece4df2f96cb92">statevec_pauliYConj</a></div><div class="ttdeci">void statevec_pauliYConj(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00251">QuEST_cpu_local.c:251</a></div></div>
<div class="ttc" id="agroup__type_html_gaeff624226629d7063a8a776958a4f991"><div class="ttname"><a href="group__type.html#gaeff624226629d7063a8a776958a4f991">destroyQuESTEnv</a></div><div class="ttdeci">void destroyQuESTEnv(QuESTEnv env)</div><div class="ttdoc">Destroy the QuEST environment.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00190">QuEST_cpu_local.c:190</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a63cb88a5f4eb12fef087435b8db3f8eb"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a63cb88a5f4eb12fef087435b8db3f8eb">statevec_calcProbOfOutcome</a></div><div class="ttdeci">qreal statevec_calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00279">QuEST_cpu_local.c:279</a></div></div>
<div class="ttc" id="amt19937ar_8c_html_ac1283f9b1ed571332f5ffe53545ffc16"><div class="ttname"><a href="mt19937ar_8c.html#ac1283f9b1ed571332f5ffe53545ffc16">init_by_array</a></div><div class="ttdeci">void init_by_array(unsigned long init_key[], int key_length)</div><div class="ttdef"><b>Definition:</b> <a href="mt19937ar_8c_source.html#l00080">mt19937ar.c:80</a></div></div>
<div class="ttc" id="agroup__debug_html_ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77"><div class="ttname"><a href="group__debug.html#ga8d31fe2d1ad4d01e2a1f5f6b8bc15b77">syncQuESTEnv</a></div><div class="ttdeci">void syncQuESTEnv(QuESTEnv env)</div><div class="ttdoc">Guarantees that all code up to the given point has been executed on all nodes (if running in distribu...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00182">QuEST_cpu_local.c:182</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_ace1482ef82b83e7f926634a67b322fc4"><div class="ttname"><a href="QuEST__cpu_8c.html#ace1482ef82b83e7f926634a67b322fc4">statevec_controlledNotLocal</a></div><div class="ttdeci">void statevec_controlledNotLocal(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02584">QuEST_cpu.c:2584</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a45b0916c3e121837f214b64f7424e479"><div class="ttname"><a href="QuEST__cpu_8c.html#a45b0916c3e121837f214b64f7424e479">statevec_pauliYLocal</a></div><div class="ttdeci">void statevec_pauliYLocal(Qureg qureg, int targetQubit, int conjFac)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02682">QuEST_cpu.c:2682</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a939897137596bb73ad7a028d0beaaa10"><div class="ttname"><a href="QuEST__cpu_8c.html#a939897137596bb73ad7a028d0beaaa10">densmatr_calcHilbertSchmidtDistanceSquaredLocal</a></div><div class="ttdeci">qreal densmatr_calcHilbertSchmidtDistanceSquaredLocal(Qureg a, Qureg b)</div><div class="ttdoc">computes Tr((a-b) conjTrans(a-b)) = sum of abs values of (a-b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00923">QuEST_cpu.c:923</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a8c13e3ef40a58a27a4c04ad69bde14bc"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a8c13e3ef40a58a27a4c04ad69bde14bc">statevec_collapseToKnownProbOutcome</a></div><div class="ttdeci">void statevec_collapseToKnownProbOutcome(Qureg qureg, int measureQubit, int outcome, qreal stateProb)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00295">QuEST_cpu_local.c:295</a></div></div>
<div class="ttc" id="astructQuESTEnv_html_aa648bb336cf8598467cb62db00b9cee8"><div class="ttname"><a href="structQuESTEnv.html#aa648bb336cf8598467cb62db00b9cee8">QuESTEnv::rank</a></div><div class="ttdeci">int rank</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00244">QuEST.h:244</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_aec63559e8b9ab0e17efe18d64d2ceca6"><div class="ttname"><a href="QuEST__cpu__local_8c.html#aec63559e8b9ab0e17efe18d64d2ceca6">statevec_compactUnitary</a></div><div class="ttdeci">void statevec_compactUnitary(Qureg qureg, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00215">QuEST_cpu_local.c:215</a></div></div>
<div class="ttc" id="astructQureg_html_aba97773694870ef35e378c036f486bb7"><div class="ttname"><a href="structQureg.html#aba97773694870ef35e378c036f486bb7">Qureg::pairStateVec</a></div><div class="ttdeci">ComplexArray pairStateVec</div><div class="ttdoc">Temporary storage for a chunk of the state vector received from another process in the MPI version.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00224">QuEST.h:224</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html"><div class="ttname"><a href="QuEST__internal_8h.html">QuEST_internal.h</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_ae37b3eff5d3affbc1edfe216cabc1c53"><div class="ttname"><a href="QuEST__cpu__local_8c.html#ae37b3eff5d3affbc1edfe216cabc1c53">densmatr_calcProbOfOutcome</a></div><div class="ttdeci">qreal densmatr_calcProbOfOutcome(Qureg qureg, int measureQubit, int outcome)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00287">QuEST_cpu_local.c:287</a></div></div>
<div class="ttc" id="aQuEST_8h_html"><div class="ttname"><a href="QuEST_8h.html">QuEST.h</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_ab5b51a28caa8792a3f0c637409a694b0"><div class="ttname"><a href="QuEST__cpu_8c.html#ab5b51a28caa8792a3f0c637409a694b0">statevec_swapQubitAmpsLocal</a></div><div class="ttdeci">void statevec_swapQubitAmpsLocal(Qureg qureg, int qb1, int qb2)</div><div class="ttdoc">It is ensured that all amplitudes needing to be swapped are on this node.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03536">QuEST_cpu.c:3536</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a600bda10463e2078ce746ec28f2d39c9"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a600bda10463e2078ce746ec28f2d39c9">statevec_multiControlledUnitary</a></div><div class="ttdeci">void statevec_multiControlledUnitary(Qureg qureg, long long int ctrlQubitsMask, long long int ctrlFlipMask, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00235">QuEST_cpu_local.c:235</a></div></div>
<div class="ttc" id="aQuEST__common_8c_html_a2b323b65cd6512720e6aa27c182fcea0"><div class="ttname"><a href="QuEST__common_8c.html#a2b323b65cd6512720e6aa27c182fcea0">getQuESTDefaultSeedKey</a></div><div class="ttdeci">void getQuESTDefaultSeedKey(unsigned long int *key)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__common_8c_source.html#l00182">QuEST_common.c:182</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a4e19ef93d01d7acea32ca646d623aedd"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a4e19ef93d01d7acea32ca646d623aedd">statevec_controlledPauliY</a></div><div class="ttdeci">void statevec_controlledPauliY(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00257">QuEST_cpu_local.c:257</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_ab02bce0ebbb8f624e8ced8b09b99cdef"><div class="ttname"><a href="QuEST__cpu_8c.html#ab02bce0ebbb8f624e8ced8b09b99cdef">statevec_collapseToKnownProbOutcomeLocal</a></div><div class="ttdeci">void statevec_collapseToKnownProbOutcomeLocal(Qureg qureg, int measureQubit, int outcome, qreal totalProbability)</div><div class="ttdoc">Update the state vector to be consistent with measuring measureQubit=0 if outcome=0 and measureQubit=...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03380">QuEST_cpu.c:3380</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_af3fc7bd149c70f083b149050242cd55e"><div class="ttname"><a href="QuEST__cpu__local_8c.html#af3fc7bd149c70f083b149050242cd55e">statevec_hadamard</a></div><div class="ttdeci">void statevec_hadamard(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00269">QuEST_cpu_local.c:269</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a398b60c4cb4fa2cf2ffc126de6c08da0"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a398b60c4cb4fa2cf2ffc126de6c08da0">densmatr_mixDepolarising</a></div><div class="ttdeci">void densmatr_mixDepolarising(Qureg qureg, int targetQubit, qreal depolLevel)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00030">QuEST_cpu_local.c:30</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_affbd18d7c2ed8d5bd5edb67116501145"><div class="ttname"><a href="QuEST__cpu__local_8c.html#affbd18d7c2ed8d5bd5edb67116501145">statevec_multiControlledTwoQubitUnitary</a></div><div class="ttdeci">void statevec_multiControlledTwoQubitUnitary(Qureg qureg, long long int ctrlMask, int q1, int q2, ComplexMatrix4 u)</div><div class="ttdoc">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00310">QuEST_cpu_local.c:310</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a5ddfdb22e4704b680d67d08d9e80835b"><div class="ttname"><a href="QuEST__cpu_8c.html#a5ddfdb22e4704b680d67d08d9e80835b">statevec_compactUnitaryLocal</a></div><div class="ttdeci">void statevec_compactUnitaryLocal(Qureg qureg, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01688">QuEST_cpu.c:1688</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_af910c7cf2b85bdc2c399cfe8dbfb8b9c"><div class="ttname"><a href="QuEST__cpu_8c.html#af910c7cf2b85bdc2c399cfe8dbfb8b9c">densmatr_calcPurityLocal</a></div><div class="ttdeci">qreal densmatr_calcPurityLocal(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00861">QuEST_cpu.c:861</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a16ccb485bcffb328bbd5b2af6977cead"><div class="ttname"><a href="QuEST__cpu_8c.html#a16ccb485bcffb328bbd5b2af6977cead">statevec_calcExpecDiagonalOpLocal</a></div><div class="ttdeci">Complex statevec_calcExpecDiagonalOpLocal(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03738">QuEST_cpu.c:3738</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a0acfe30083d0bc2a84da196378a36122"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a0acfe30083d0bc2a84da196378a36122">statevec_multiControlledMultiQubitUnitary</a></div><div class="ttdeci">void statevec_multiControlledMultiQubitUnitary(Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdoc">This calls swapQubitAmps only when it would involve a distributed communication; if the qubit chunks ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00315">QuEST_cpu_local.c:315</a></div></div>
<div class="ttc" id="astructComplexMatrix4_html"><div class="ttname"><a href="structComplexMatrix4.html">ComplexMatrix4</a></div><div class="ttdoc">Represents a 4x4 matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00125">QuEST.h:125</a></div></div>
<div class="ttc" id="astructQuESTEnv_html"><div class="ttname"><a href="structQuESTEnv.html">QuESTEnv</a></div><div class="ttdoc">Information about the environment the program is running in.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00242">QuEST.h:242</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a0aedcccfa50c7aaa8b7fc4c14d7cdfb8"><div class="ttname"><a href="QuEST__cpu_8c.html#a0aedcccfa50c7aaa8b7fc4c14d7cdfb8">statevec_multiControlledMultiQubitUnitaryLocal</a></div><div class="ttdeci">void statevec_multiControlledMultiQubitUnitaryLocal(Qureg qureg, long long int ctrlMask, int *targs, int numTargs, ComplexMatrixN u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01846">QuEST_cpu.c:1846</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_af8236a00389137b5eff986a40577eaf3"><div class="ttname"><a href="QuEST__cpu_8c.html#af8236a00389137b5eff986a40577eaf3">statevec_multiControlledTwoQubitUnitaryLocal</a></div><div class="ttdeci">void statevec_multiControlledTwoQubitUnitaryLocal(Qureg qureg, long long int ctrlMask, int q1, int q2, ComplexMatrix4 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01747">QuEST_cpu.c:1747</a></div></div>
<div class="ttc" id="astructComplexMatrixN_html"><div class="ttname"><a href="structComplexMatrixN.html">ComplexMatrixN</a></div><div class="ttdoc">Represents a general 2^N by 2^N matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00136">QuEST.h:136</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_abb2eab4af99adcc59be24f4c91c6f6ad"><div class="ttname"><a href="QuEST__cpu__local_8c.html#abb2eab4af99adcc59be24f4c91c6f6ad">statevec_controlledNot</a></div><div class="ttdeci">void statevec_controlledNot(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00274">QuEST_cpu_local.c:274</a></div></div>
<div class="ttc" id="amt19937ar_8h_html"><div class="ttname"><a href="mt19937ar_8h.html">mt19937ar.h</a></div></div>
<div class="ttc" id="agroup__type_html_ga7740e349b4f8bae6451547680f0ce2d6"><div class="ttname"><a href="group__type.html#ga7740e349b4f8bae6451547680f0ce2d6">qreal</a></div><div class="ttdeci">#define qreal</div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a1275d604674224d87a173fb5bac78835"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a1275d604674224d87a173fb5bac78835">statevec_controlledCompactUnitary</a></div><div class="ttdeci">void statevec_controlledCompactUnitary(Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00225">QuEST_cpu_local.c:225</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a4a2fa262d3f0dba372797b9bd35d9fa5"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a4a2fa262d3f0dba372797b9bd35d9fa5">statevec_controlledPauliYConj</a></div><div class="ttdeci">void statevec_controlledPauliYConj(Qureg qureg, int controlQubit, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00263">QuEST_cpu_local.c:263</a></div></div>
<div class="ttc" id="aQuEST__cpu__internal_8h_html"><div class="ttname"><a href="QuEST__cpu__internal_8h.html">QuEST_cpu_internal.h</a></div></div>
<div class="ttc" id="astructDiagonalOp_html_a85c3f52533efe831bbe40b9a48602388"><div class="ttname"><a href="structDiagonalOp.html#a85c3f52533efe831bbe40b9a48602388">DiagonalOp::imag</a></div><div class="ttdeci">qreal * imag</div><div class="ttdoc">The imaginary values of the 2^numQubits complex elements.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00191">QuEST.h:191</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_aa6c3f86010ad398f42b0577ea3bb5bcf"><div class="ttname"><a href="QuEST__cpu__local_8c.html#aa6c3f86010ad398f42b0577ea3bb5bcf">densmatr_calcFidelity</a></div><div class="ttdeci">qreal densmatr_calcFidelity(Qureg qureg, Qureg pureState)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00075">QuEST_cpu_local.c:75</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a561b599a69a5dab03e55b7cbe259892d"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a561b599a69a5dab03e55b7cbe259892d">densmatr_initPureState</a></div><div class="ttdeci">void densmatr_initPureState(Qureg qureg, Qureg pureState)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00095">QuEST_cpu_local.c:95</a></div></div>
<div class="ttc" id="astructQureg_html_ab0ea0358482b62f43fdd781469607d97"><div class="ttname"><a href="structQureg.html#ab0ea0358482b62f43fdd781469607d97">Qureg::numAmpsPerChunk</a></div><div class="ttdeci">long long int numAmpsPerChunk</div><div class="ttdoc">Number of probability amplitudes held in stateVec by this process In the non-MPI version,...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00213">QuEST.h:213</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a3510f01d4d15dcc545564eb84c668cad"><div class="ttname"><a href="QuEST__cpu_8c.html#a3510f01d4d15dcc545564eb84c668cad">densmatr_mixTwoQubitDepolarisingLocal</a></div><div class="ttdeci">void densmatr_mixTwoQubitDepolarisingLocal(Qureg qureg, int qubit1, int qubit2, qreal delta, qreal gamma)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00387">QuEST_cpu.c:387</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a06fb16aa4af7c54d36052a14d3ad58a7"><div class="ttname"><a href="QuEST__cpu_8c.html#a06fb16aa4af7c54d36052a14d3ad58a7">statevec_controlledPauliYLocal</a></div><div class="ttdeci">void statevec_controlledPauliYLocal(Qureg qureg, int controlQubit, int targetQubit, int conjFac)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02776">QuEST_cpu.c:2776</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a7ebd3198a198f4cd20840f64fd8b84d0"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a7ebd3198a198f4cd20840f64fd8b84d0">statevec_calcInnerProduct</a></div><div class="ttdeci">Complex statevec_calcInnerProduct(Qureg bra, Qureg ket)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00113">QuEST_cpu_local.c:113</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_add9ca9956cdd81ed5d0b0f66168c04a3"><div class="ttname"><a href="QuEST__cpu__local_8c.html#add9ca9956cdd81ed5d0b0f66168c04a3">statevec_controlledUnitary</a></div><div class="ttdeci">void statevec_controlledUnitary(Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00230">QuEST_cpu_local.c:230</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_ae45eefa65f4ecd37bab84fade7cf7f1f"><div class="ttname"><a href="QuEST__cpu__local_8c.html#ae45eefa65f4ecd37bab84fade7cf7f1f">densmatr_calcPurity</a></div><div class="ttdeci">qreal densmatr_calcPurity(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00057">QuEST_cpu_local.c:57</a></div></div>
<div class="ttc" id="astructQuESTEnv_html_af22aacd7c9905accae28484785c193b4"><div class="ttname"><a href="structQuESTEnv.html#af22aacd7c9905accae28484785c193b4">QuESTEnv::numRanks</a></div><div class="ttdeci">int numRanks</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00245">QuEST.h:245</a></div></div>
<div class="ttc" id="aQuEST__internal_8h_html_a623e577b7230f3c8dc202be6185b4289"><div class="ttname"><a href="QuEST__internal_8h.html#a623e577b7230f3c8dc202be6185b4289">densmatr_mixTwoQubitDephasing</a></div><div class="ttdeci">void densmatr_mixTwoQubitDephasing(Qureg qureg, int qubit1, int qubit2, qreal dephase)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00084">QuEST_cpu.c:84</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a0fb948ddab4ca210e523aa3c52639df4"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a0fb948ddab4ca210e523aa3c52639df4">statevec_calcExpecDiagonalOp</a></div><div class="ttdeci">Complex statevec_calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00340">QuEST_cpu_local.c:340</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_ab19f28e68330da68ea3caa2bdef32da9"><div class="ttname"><a href="QuEST__cpu_8c.html#ab19f28e68330da68ea3caa2bdef32da9">statevec_multiControlledUnitaryLocal</a></div><div class="ttdeci">void statevec_multiControlledUnitaryLocal(Qureg qureg, int targetQubit, long long int ctrlQubitsMask, long long int ctrlFlipMask, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02173">QuEST_cpu.c:2173</a></div></div>
<div class="ttc" id="astructDiagonalOp_html"><div class="ttname"><a href="structDiagonalOp.html">DiagonalOp</a></div><div class="ttdoc">Represents a diagonal complex operator on the full Hilbert state of a Qureg.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00178">QuEST.h:178</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_aeb4453a2e609e5359d2995bccf6663ca"><div class="ttname"><a href="QuEST__cpu_8c.html#aeb4453a2e609e5359d2995bccf6663ca">densmatr_calcExpecDiagonalOpLocal</a></div><div class="ttdeci">Complex densmatr_calcExpecDiagonalOpLocal(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03781">QuEST_cpu.c:3781</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_aa987d1e0ba97da2ca540194356dd62de"><div class="ttname"><a href="QuEST__cpu_8c.html#aa987d1e0ba97da2ca540194356dd62de">statevec_pauliXLocal</a></div><div class="ttdeci">void statevec_pauliXLocal(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02498">QuEST_cpu.c:2498</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a1b36518c8fbbc3a5084bb4ad1fb05ea5"><div class="ttname"><a href="QuEST__cpu_8c.html#a1b36518c8fbbc3a5084bb4ad1fb05ea5">densmatr_initPureStateLocal</a></div><div class="ttdeci">void densmatr_initPureStateLocal(Qureg targetQureg, Qureg copyQureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01184">QuEST_cpu.c:1184</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_af1cca787f3b0e0c91ffb2495f9ad8d5a"><div class="ttname"><a href="QuEST__cpu__local_8c.html#af1cca787f3b0e0c91ffb2495f9ad8d5a">statevec_pauliY</a></div><div class="ttdeci">void statevec_pauliY(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00245">QuEST_cpu_local.c:245</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a1c82b5e914a8a39c5c7b782dbc16fa76"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a1c82b5e914a8a39c5c7b782dbc16fa76">statevec_pauliX</a></div><div class="ttdeci">void statevec_pauliX(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00240">QuEST_cpu_local.c:240</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_ab124a3a9956046bf9c0e1e3ae9171f42"><div class="ttname"><a href="QuEST__cpu_8c.html#ab124a3a9956046bf9c0e1e3ae9171f42">densmatr_mixDampingLocal</a></div><div class="ttdeci">void densmatr_mixDampingLocal(Qureg qureg, int targetQubit, qreal damping)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00174">QuEST_cpu.c:174</a></div></div>
<div class="ttc" id="astructQureg_html"><div class="ttname"><a href="structQureg.html">Qureg</a></div><div class="ttdoc">Represents a system of qubits.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00203">QuEST.h:203</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a6ff3dc624b5fafe8edae4fe327c255a0"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a6ff3dc624b5fafe8edae4fe327c255a0">densmatr_calcInnerProduct</a></div><div class="ttdeci">qreal densmatr_calcInnerProduct(Qureg a, Qureg b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00069">QuEST_cpu_local.c:69</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a08392b1b27d10e3b8a8648a5afeaa629"><div class="ttname"><a href="QuEST__cpu_8c.html#a08392b1b27d10e3b8a8648a5afeaa629">densmatr_calcInnerProductLocal</a></div><div class="ttdeci">qreal densmatr_calcInnerProductLocal(Qureg a, Qureg b)</div><div class="ttdoc">computes Tr(conjTrans(a) b) = sum of (a_ij^* b_ij)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00958">QuEST_cpu.c:958</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_aedd7ecccf2f09dd2f1c5d191950b51e6"><div class="ttname"><a href="QuEST__cpu__local_8c.html#aedd7ecccf2f09dd2f1c5d191950b51e6">densmatr_applyDiagonalOp</a></div><div class="ttdeci">void densmatr_applyDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00325">QuEST_cpu_local.c:325</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_ad65ad1b5ea6f30b0c6b4ffda96e1a8e6"><div class="ttname"><a href="QuEST__cpu__local_8c.html#ad65ad1b5ea6f30b0c6b4ffda96e1a8e6">statevec_calcTotalProb</a></div><div class="ttdeci">qreal statevec_calcTotalProb(Qureg qureg)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00141">QuEST_cpu_local.c:141</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a43afa97e300b87bce7f3eb1213eb05f6"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a43afa97e300b87bce7f3eb1213eb05f6">densmatr_mixTwoQubitDepolarising</a></div><div class="ttdeci">void densmatr_mixTwoQubitDepolarising(Qureg qureg, int qubit1, int qubit2, qreal depolLevel)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00044">QuEST_cpu_local.c:44</a></div></div>
<div class="ttc" id="aQuEST__precision_8h_html"><div class="ttname"><a href="QuEST__precision_8h.html">QuEST_precision.h</a></div></div>
<div class="ttc" id="astructQureg_html_a441e4cacef6bd17adb9813c7442d42fe"><div class="ttname"><a href="structQureg.html#a441e4cacef6bd17adb9813c7442d42fe">Qureg::stateVec</a></div><div class="ttdeci">ComplexArray stateVec</div><div class="ttdoc">Computational state amplitudes - a subset thereof in the MPI version.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00222">QuEST.h:222</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_abd509244d57657e148e4084c5ab5d28f"><div class="ttname"><a href="QuEST__cpu__local_8c.html#abd509244d57657e148e4084c5ab5d28f">statevec_getImagAmp</a></div><div class="ttdeci">qreal statevec_getImagAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00211">QuEST_cpu_local.c:211</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_ab750fb47da2fca9849c678c869e40e69"><div class="ttname"><a href="QuEST__cpu_8c.html#ab750fb47da2fca9849c678c869e40e69">densmatr_mixDepolarisingLocal</a></div><div class="ttdeci">void densmatr_mixDepolarisingLocal(Qureg qureg, int targetQubit, qreal depolLevel)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00125">QuEST_cpu.c:125</a></div></div>
<div class="ttc" id="agroup__debug_html_gaa8437ef3bf135231e2916e64dde1c94e"><div class="ttname"><a href="group__debug.html#gaa8437ef3bf135231e2916e64dde1c94e">seedQuESTDefault</a></div><div class="ttdeci">void seedQuESTDefault(void)</div><div class="ttdoc">Seed the Mersenne Twister used for random number generation in the QuEST environment with an example ...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00300">QuEST_cpu_local.c:300</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a86dbcc3db99294add9964741e19fbdab"><div class="ttname"><a href="QuEST__cpu_8c.html#a86dbcc3db99294add9964741e19fbdab">statevec_hadamardLocal</a></div><div class="ttdeci">void statevec_hadamardLocal(Qureg qureg, int targetQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02872">QuEST_cpu.c:2872</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a8c9da88f734b0862f4cce7d819e6d3b5"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a8c9da88f734b0862f4cce7d819e6d3b5">densmatr_calcHilbertSchmidtDistance</a></div><div class="ttdeci">qreal densmatr_calcHilbertSchmidtDistance(Qureg a, Qureg b)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00062">QuEST_cpu_local.c:62</a></div></div>
<div class="ttc" id="agroup__debug_html_gaf8a14ae79c3fb2c0b5f6255cc37bebf9"><div class="ttname"><a href="group__debug.html#gaf8a14ae79c3fb2c0b5f6255cc37bebf9">reportQuESTEnv</a></div><div class="ttdeci">void reportQuESTEnv(QuESTEnv env)</div><div class="ttdoc">Report information about the QuEST environment.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00194">QuEST_cpu_local.c:194</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_afa58cf7cb98a25ab33621120c5c330d0"><div class="ttname"><a href="QuEST__cpu_8c.html#afa58cf7cb98a25ab33621120c5c330d0">densmatr_applyDiagonalOpLocal</a></div><div class="ttdeci">void densmatr_applyDiagonalOpLocal(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03696">QuEST_cpu.c:3696</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a903beb4f5d8753a964ce2dc5f9096a24"><div class="ttname"><a href="QuEST__cpu_8c.html#a903beb4f5d8753a964ce2dc5f9096a24">statevec_controlledUnitaryLocal</a></div><div class="ttdeci">void statevec_controlledUnitaryLocal(Qureg qureg, int controlQubit, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02241">QuEST_cpu.c:2241</a></div></div>
<div class="ttc" id="astructQureg_html_ad08dff5316b8937f4b2a1417591543dc"><div class="ttname"><a href="structQureg.html#ad08dff5316b8937f4b2a1417591543dc">Qureg::numQubitsRepresented</a></div><div class="ttdeci">int numQubitsRepresented</div><div class="ttdoc">The number of qubits represented in either the state-vector or density matrix.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00208">QuEST.h:208</a></div></div>
<div class="ttc" id="agroup__debug_html_gac7e38d768a1bd79019f88cc1e6295092"><div class="ttname"><a href="group__debug.html#gac7e38d768a1bd79019f88cc1e6295092">syncQuESTSuccess</a></div><div class="ttdeci">int syncQuESTSuccess(int successCode)</div><div class="ttdoc">Performs a logical AND on all successCodes held by all processes.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00186">QuEST_cpu_local.c:186</a></div></div>
<div class="ttc" id="astructDiagonalOp_html_a1d66088bed235d524cd452b107694d5c"><div class="ttname"><a href="structDiagonalOp.html#a1d66088bed235d524cd452b107694d5c">DiagonalOp::real</a></div><div class="ttdeci">qreal * real</div><div class="ttdoc">The real values of the 2^numQubits complex elements.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00189">QuEST.h:189</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_ac501fe7b9d331be48359ce1546348f97"><div class="ttname"><a href="QuEST__cpu__local_8c.html#ac501fe7b9d331be48359ce1546348f97">densmatr_mixDamping</a></div><div class="ttdeci">void densmatr_mixDamping(Qureg qureg, int targetQubit, qreal damping)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00037">QuEST_cpu_local.c:37</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_aafc398f8f479fcc066a2dea700235635"><div class="ttname"><a href="QuEST__cpu_8c.html#aafc398f8f479fcc066a2dea700235635">statevec_unitaryLocal</a></div><div class="ttdeci">void statevec_unitaryLocal(Qureg qureg, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01932">QuEST_cpu.c:1932</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a8bea931504c90d9bd97e74645667804e"><div class="ttname"><a href="QuEST__cpu_8c.html#a8bea931504c90d9bd97e74645667804e">densmatr_findProbabilityOfZeroLocal</a></div><div class="ttdeci">qreal densmatr_findProbabilityOfZeroLocal(Qureg qureg, int measureQubit)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03151">QuEST_cpu.c:3151</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_abc9a9ef4344c7faaaf28ac25c76649b9"><div class="ttname"><a href="QuEST__cpu__local_8c.html#abc9a9ef4344c7faaaf28ac25c76649b9">statevec_getRealAmp</a></div><div class="ttdeci">qreal statevec_getRealAmp(Qureg qureg, long long int index)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00207">QuEST_cpu_local.c:207</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_a70e3b0a2297c186d5c779af31459b4ca"><div class="ttname"><a href="QuEST__cpu__local_8c.html#a70e3b0a2297c186d5c779af31459b4ca">densmatr_calcExpecDiagonalOp</a></div><div class="ttdeci">Complex densmatr_calcExpecDiagonalOp(Qureg qureg, DiagonalOp op)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00345">QuEST_cpu_local.c:345</a></div></div>
<div class="ttc" id="astructComplex_html"><div class="ttname"><a href="structComplex.html">Complex</a></div><div class="ttdoc">Represents one complex number.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00103">QuEST.h:103</a></div></div>
<div class="ttc" id="agroup__type_html_ga8ba2c3388dd64d9348c3b091852d36d4"><div class="ttname"><a href="group__type.html#ga8ba2c3388dd64d9348c3b091852d36d4">createQuESTEnv</a></div><div class="ttdeci">QuESTEnv createQuESTEnv(void)</div><div class="ttdoc">Create the QuEST execution environment.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00170">QuEST_cpu_local.c:170</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a215e2d6f88dbecc0b408b3573b5e144f"><div class="ttname"><a href="QuEST__cpu_8c.html#a215e2d6f88dbecc0b408b3573b5e144f">statevec_controlledCompactUnitaryLocal</a></div><div class="ttdeci">void statevec_controlledCompactUnitaryLocal(Qureg qureg, int controlQubit, int targetQubit, Complex alpha, Complex beta)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l02101">QuEST_cpu.c:2101</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a6fbb3b693f25dde1e9e3dc87dc1984f7"><div class="ttname"><a href="QuEST__cpu_8c.html#a6fbb3b693f25dde1e9e3dc87dc1984f7">statevec_calcInnerProductLocal</a></div><div class="ttdeci">Complex statevec_calcInnerProductLocal(Qureg bra, Qureg ket)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l01071">QuEST_cpu.c:1071</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_ac3735bd959600e57b2ee3a105666cddf"><div class="ttname"><a href="QuEST__cpu__local_8c.html#ac3735bd959600e57b2ee3a105666cddf">statevec_unitary</a></div><div class="ttdeci">void statevec_unitary(Qureg qureg, int targetQubit, ComplexMatrix2 u)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00220">QuEST_cpu_local.c:220</a></div></div>
<div class="ttc" id="astructComplexMatrix2_html"><div class="ttname"><a href="structComplexMatrix2.html">ComplexMatrix2</a></div><div class="ttdoc">Represents a 2x2 matrix of complex numbers.</div><div class="ttdef"><b>Definition:</b> <a href="QuEST_8h_source.html#l00114">QuEST.h:114</a></div></div>
<div class="ttc" id="aQuEST__cpu__local_8c_html_ab7478fcaf6357ab202d72853b672e375"><div class="ttname"><a href="QuEST__cpu__local_8c.html#ab7478fcaf6357ab202d72853b672e375">statevec_swapQubitAmps</a></div><div class="ttdeci">void statevec_swapQubitAmps(Qureg qureg, int qb1, int qb2)</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu__local_8c_source.html#l00320">QuEST_cpu_local.c:320</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a7772f97cb4d92a9825bf3b7c82c3230c"><div class="ttname"><a href="QuEST__cpu_8c.html#a7772f97cb4d92a9825bf3b7c82c3230c">densmatr_calcFidelityLocal</a></div><div class="ttdeci">qreal densmatr_calcFidelityLocal(Qureg qureg, Qureg pureState)</div><div class="ttdoc">computes a few dens-columns-worth of (vec^*T) dens * vec</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l00990">QuEST_cpu.c:990</a></div></div>
<div class="ttc" id="aQuEST__cpu_8c_html_a8535bc15c2ff249ddddb3fde6eff1490"><div class="ttname"><a href="QuEST__cpu_8c.html#a8535bc15c2ff249ddddb3fde6eff1490">statevec_findProbabilityOfZeroLocal</a></div><div class="ttdeci">qreal statevec_findProbabilityOfZeroLocal(Qureg qureg, int measureQubit)</div><div class="ttdoc">Measure the total probability of a specified qubit being in the zero state across all amplitudes in t...</div><div class="ttdef"><b>Definition:</b> <a href="QuEST__cpu_8c_source.html#l03206">QuEST_cpu.c:3206</a></div></div>
<!-- HTML footer for doxygen 1.8.8-->
<!-- start footer part -->
</div>
</div>
</div>
</div>
</div>
</body>
        <script type="text/javascript" src="boot.js"></script>
</html>
